/**
 * 状态选择器
 */
export default {
  functional: true,
  name: 'StatusSelect',
  props: {
    value: {
      type: [String, Number, Boolean],
      default: ''
    },
    options: {
      type: Array,
      default: () => [
        { label: '全部', value: '' },
        { label: '上架', value: true },
        { label: '下架', value: false }
      ]
    }
  },
  render(h, ctx) {
    const { props, listeners } = ctx
    const { value, options } = props
    const { input } = listeners
    return (
      <el-select
        value={value}
        onInput={v => input(v)}
        placeholder="请选择状态"
      >
        {
          options.map(v => (
            <el-option
              key={v.value}
              label={v.label}
              value={v.value}
            /> 
          ))
        }
      </el-select>
    )
  }
}